/* 
* @Author: anchen
* @Date:   2018-12-31 10:08:15
* @Last Modified by:   anchen
* @Last Modified time: 2018-12-31 15:48:41
*/
$(function () {

});

function searchData() {


    var table = layui.table, layer = layui.layer;

    table.init('serviceTable',{
        data: [

            {
                id: 1,
                "table_type":"已婚",
                "SFID_NAN":"350233********0072",
                "SFID_NV":"350233********0071",
                "NAME_NAN":"黄小军",
                "NAME_NV":"黄小君"
            }
        ]
        , toolbar: true
        , title: '民政婚姻信息查询(婚姻信息)'
        , page: true
    });

    //监听行工具事件
    table.on('tool(serviceTable)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值

        if (layEvent === 'detail') {
            loadDetail(data.id)
        }
    });
}

function loadDetail(id) {
    var data = [
           {
            "table_type":"已婚",
            "SFID_NAN":"350233********0072",
            "SFID_NV":"350233********0071",
            "NAME_NAN":"黄小军",
            "NAME_NV":"黄小君",
            "DJ_DATE":"2018-12-31",
            "ZJID":"23232323",
            "DJJG":"***机关",
            "BIRTHDATE_NAN":"1993-09-01",
            "BIRTHDATE_NV":"1993-10-01",
            "GJ_NAN":"中国",
            "GJ_NAV":"中国"
        }
    ];


    var data0 = data[parseInt(id) - 1];

    $('#detailD').html(template('detailDS',{data:data0}))
    layer.open({
        type: 1,
        content: $("#detail"),
        area: ['900px', '550px'],
        title: '民政婚姻信息查询(婚姻信息)',
        maxmin: true,
        shade: 0,
        cancel: function () {
            $("#detail").hide()
        }
    });


}